package cz.jj.tstr;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.net.sip.SipSession;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.RadioGroup;
import android.widget.Switch;

public class SwitchListener implements CompoundButton.OnCheckedChangeListener {
    Activity ac;

    public SwitchListener(Activity ac){
        this.ac=ac;


    }


    @SuppressLint("WrongViewCast")
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

        if(isChecked) {
            if(buttonView.getId()==R.id.pass_req){
                ac.findViewById(R.id.password).setEnabled(true);

            }else{
                ac.findViewById(R.id.pub_key_opt).setVisibility(View.VISIBLE);


            }
        } else {
            if(buttonView.getId()==R.id.pass_req){
                ac.findViewById(R.id.password).setEnabled(false);





            }else{
                ac.findViewById(R.id.pub_key_opt).setVisibility(View.GONE);



            }
        }

    }
}
